#ifndef __AB_PARA__H
#define __AB_PARA__H

#define     AB_CHANNEL_NUM   64             //通道数总数
#define     AB_RANDE_NUM     19             //幅度分布
#define     AB_TABLE_NUM     10
#define     SECTOR_NUM       0x03           //扇区总个数
#define     VALN_BUF_LEN     1600
#define     AMPLITBUFF_LEN   (16*16+16*16)    //一包数据的大小,不包含包头, 只包含所有的TR组件

/* 误差校准数据相关 */
#define     CalibErrorOneLEN 128*2*5
#define     CalibErrorDLEN   CalibErrorOneLEN*4
#define     CalibErrorDNAME  "/mnt/calib.bin"
#define     PZ_PL_UART_422   "/dev/ttyUL0" 

#define     PZ_PL_UART_DLEN  5

#define     DTYPE__RANG       0x01       
#define     DTYPE_PHASE       0x02  

#define     DEG_UINT_NET      0.01
#define     DEG_UINT          100.0
#define     DEG_MAX_360       360
#define     DEG_UINT_TO_U8BIN 5.625    
#define     DEG_FOR_COMPAR    10000
#define     RANG_MAX_31_49    31.49
#define     PHSE_MAX_357_X    357.1875

/* 2.8125: 360°/128 */
#define     DEG_INTER         2.8125  
#define     DEG_INTER_HALF    1.40625   

/* file download */
typedef struct {
    uint8 fhead;
    uint8 ftype;
    uint8 updateType;
    uint16 filesize;
    uint16 filelen;
    uint16 fileindex;
    uint8 fbuf[1400];
    uint8 check;
    uint8 end;
}__attribute__((packed)) DloadFile;

typedef enum {
    D_STATUS_SUCCSE,    //传输成功
    D_STATUS_OVER,      //传输完毕
    D_STATUS_FAILED,    //传输失败
} DFILE_Status;

typedef struct 
{
    unsigned int type;      //0x01 发送  0x02 接收
    unsigned int freq;      //频率
    double rbuf[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
} AB_PData;


extern double T_9330[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double T_9370[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double T_9410[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double T_9450[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double T_9490[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double R_9330[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double R_9370[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double R_9410[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double R_9450[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double R_9490[AB_RANDE_NUM][AB_CHANNEL_NUM + 1];
extern double T_AMPLIT[AB_CHANNEL_NUM + 1];
extern double R_AMPLIT[AB_CHANNEL_NUM + 1];

#define     ABP_TYPE_SEND       0x01
#define     ABP_TYPE_RECV       0x02
#define     ABP_FREQ_NUM        0x05
#define     ABP_FREQ_9330MHZ    9330
#define     ABP_FREQ_9370MHZ    9370
#define     ABP_FREQ_9410MHZ    9410
#define     ABP_FREQ_9450MHZ    9450
#define     ABP_FREQ_9490MHZ    9490

extern int check_head[AB_RANDE_NUM];
#endif // !__AB_PARA__H